<template>
	<div class="useview allbgc">
		<div class="useview-top alltop">
			<span><router-link to='/user'><</router-link></span>
			<p>修改昵称</p>
		</div>
		
		<van-field v-model="nickname" label="昵称" clearable placeholder="请输入用户名" />
		
		<div class="photo">
			<van-button round block type="primary" size="normal" :square="true" native-type="submit" color="#07c160" style="margin: 5% auto;" @click="edit_nickname">修改昵称</van-button>
		</div>
		
		
	</div>
</template>

<script>
	export default{
		data(){
			return{
				nickname:''
			}
		},
		created() {
			this.nickname=this.$route.query.nickname
		},
		methods:{
			edit_nickname(){
				let {nickname} =this
				if(nickname.trim().length===0){
					this.$toast('不能为空')
					return
				}
				this.$toast('修改成功')
				
				// sessionStorage
				sessionStorage.setItem('nickname',nickname)
				
				setTimeout(v=>{
					this.$router.back()
				},300)
			}
		}
	}
</script>

<style>
</style>